<?php
/*
*血压
*/
class XueyaAction extends Action{

	/*
	*血压
	*more-xy01.html
	*/
	public function index(){
	$reportid = $_GET['reportid'];

        $Base = A('Base');

        $reportinfo = $Base->reportInfo($reportid);
        $iteminfo = $Base->getItemInfo($reportid);

        $username = $reportinfo['username'];
        $userage = date('Y') - substr($reportinfo['birthday'], 0, 4);

          if (empty($reportinfo['birthday']))
        {
            $userage = null;
        }
        else
        {
            $userage = date('Y') - substr($reportinfo['birthday'], 0, 4);
        }
        // var_dump($userage);exit();
        $sex = $reportinfo['gender'];

        $height = $iteminfo[0]['result'];
        $weight = $iteminfo[1]['result'];

        $array['bmi'] = round($weight / (($height * 0.01) * ($height * 0.01)), 1);

        $array['name'] = $username;
        $array['age'] = $userage;
        $array['sex'] = $sex;
        $array['bmi'] = round($weight / (($height * 0.01) * ($height * 0.01)), 1);
        $array['bmip'] = ($array['bmi'] - 7.2) * 5.07;
        $array['bmipic'] = round(($array['bmi'] - 7.6) / 1.68);

        $this->assign('user', $array);

        $this->display();
	}

	/*
	*血清总胆固醇
	*more-xz01.html
	*/
	public function danguchun(){
		$reportid = $_GET['reportid'];

        $Base = A('Base');

        $reportinfo = $Base->reportInfo($reportid);
        $iteminfo = $Base->getItemInfo($reportid);

        $username = $reportinfo['username'];
        $userage = date('Y') - substr($reportinfo['birthday'], 0, 4);
        
        if (empty($reportinfo['birthday']))
        {
            $userage = null;
        }
        else
        {
            $userage = date('Y') - substr($reportinfo['birthday'], 0, 4);
        }

        $sex = $reportinfo['gender'];

        $height = $iteminfo[0]['result'];
        $weight = $iteminfo[1]['result'];

        $array['bmi'] = round($weight / (($height * 0.01) * ($height * 0.01)), 1);

        $array['name'] = $username;
        $array['age'] = $userage;
        $array['sex'] = $sex;
        $array['bmi'] = round($weight / (($height * 0.01) * ($height * 0.01)), 1);
        $array['bmip'] = ($array['bmi'] - 7.2) * 5.07;
        $array['bmipic'] = round(($array['bmi'] - 7.6) / 1.68);

        $this->assign('user', $array);

        $this->display();
	}

	/*
	*丙氨酸氨基转移酶
	*more-xz01.html
	*/
	public function zym(){
		$reportid = $_GET['reportid'];

        $Base = A('Base');

        $reportinfo = $Base->reportInfo($reportid);
        $iteminfo = $Base->getItemInfo($reportid);

        $username = $reportinfo['username'];
        $userage = date('Y') - substr($reportinfo['birthday'], 0, 4);
        
        if (empty($reportinfo['birthday']))
        {
            $userage = null;
        }
        else
        {
            $userage = date('Y') - substr($reportinfo['birthday'], 0, 4);
        }

        $sex = $reportinfo['gender'];

        $height = $iteminfo[0]['result'];
        $weight = $iteminfo[1]['result'];

        $array['bmi'] = round($weight / (($height * 0.01) * ($height * 0.01)), 1);

        $array['name'] = $username;
        $array['age'] = $userage;
        $array['sex'] = $sex;
        $array['bmi'] = round($weight / (($height * 0.01) * ($height * 0.01)), 1);
        $array['bmip'] = ($array['bmi'] - 7.2) * 5.07;
        $array['bmipic'] = round(($array['bmi'] - 7.6) / 1.68);

        $this->assign('user', $array);

        $this->display();
	}
}